﻿using d1Common.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using d1Project.Modules.Common.do4A.Models;
using d1Project.Modules.Common.do4A.Domain;
using d1Common;

namespace d1Project.Modules.Common.do4A.Services
{
    public abstract class do4AServiceBase
    {
        public IToken GetToken0(string _tokenValue)
        {
            throw new Exception("尚未实现GetToken0");
        }

        public IDictionary<string, IRolePermission> GetRolePermissions(string _roleID)
        {
            if (PermissionMgr.Instance.RolePermisssions.ContainsKey(_roleID)) return PermissionMgr.Instance.RolePermisssions[_roleID];
            IDictionary < string, IRolePermission >  _results = this.GetRolePermissionsData(_roleID);
            PermissionMgr.Instance.RolePermisssions[_roleID] = _results;
            return _results;
        }
        protected abstract IDictionary<string, IRolePermission> GetRolePermissionsData(string _roleID);
    }

}